package br.com.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MatcherUteis {
	public static void main(String[] args) {
		CharSequence inputStr = "no 7up 4 _u too!";
		String patternStr = "[a-zA-Z0-9_]+";
		Matcher matcher = Pattern.compile(patternStr).matcher(inputStr);
		StringBuffer buf = new StringBuffer();
		while (matcher.find()) {
			String matchedStr = matcher.group();
			matchedStr = Character.toUpperCase(matchedStr.charAt(0))
					+ matchedStr.substring(1);
			matcher.appendReplacement(buf, matchedStr);
			break;
		}
		//matcher.appendTail(buf);
		System.out.println(buf);
	}
}
